package cn.com.ccxe.service;

import java.sql.SQLException;

import com.ccxe.manage.dao.impl.AdminLoginDaoImpl;
import com.ccxe.manage.dao.impl.NomalUserLoginDaoImpl;
import com.ccxe.manage.dao.impl.UserLoginDao;
import com.ccxe.manage.service.CurrUserInfo;


public class LoginBussiness {

	
	
	public boolean customerLogin(String username, String password) {
		try {
			return (new NomalUserLoginDaoImpl()).getLogin(username, password);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	
	public boolean adminLogin(String username, String password) {
		try {
			return new AdminLoginDaoImpl().getLogin(username, password);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	
	public CurrUserInfo getCurrUserInfo(String userId){
		
		CurrUserInfo currUser = null;
		try {
			currUser =  new UserLoginDao().getCurrUserInfo(userId);
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return currUser;
	}
}
